﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.mysql
{
	// Token: 0x02000153 RID: 339
	public class TMySQLCreateTrigger : TStoredProcedureSqlStatement
	{
		// Token: 0x06000B64 RID: 2916 RVA: 0x003060C1 File Offset: 0x003042C1
		public TMySQLCreateTrigger(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmysqlcreatetrigger;
		}

		// Token: 0x06000B65 RID: 2917 RVA: 0x003060D5 File Offset: 0x003042D5
		internal override void buildsql()
		{
		}

		// Token: 0x06000B66 RID: 2918 RVA: 0x003060D7 File Offset: 0x003042D7
		internal override void clear()
		{
		}

		// Token: 0x06000B67 RID: 2919 RVA: 0x003060D9 File Offset: 0x003042D9
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000B68 RID: 2920 RVA: 0x003060E0 File Offset: 0x003042E0
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000215 RID: 533
		// (get) Token: 0x06000B69 RID: 2921 RVA: 0x003060E2 File Offset: 0x003042E2
		public override TObjectName StoredProcedureName
		{
			get
			{
				return this.triggerName;
			}
		}

		// Token: 0x17000216 RID: 534
		// (get) Token: 0x06000B6A RID: 2922 RVA: 0x003060EA File Offset: 0x003042EA
		// (set) Token: 0x06000B6B RID: 2923 RVA: 0x003060F2 File Offset: 0x003042F2
		public virtual TTable OnTable
		{
			get
			{
				return this.onTable;
			}
			set
			{
				this.onTable = value;
			}
		}

		// Token: 0x17000217 RID: 535
		// (get) Token: 0x06000B6C RID: 2924 RVA: 0x003060FB File Offset: 0x003042FB
		// (set) Token: 0x06000B6D RID: 2925 RVA: 0x00306116 File Offset: 0x00304316
		public override TStatementList BodyStatements
		{
			get
			{
				if (this.bodyStatements == null)
				{
					this.bodyStatements = new TStatementList();
				}
				return this.bodyStatements;
			}
			set
			{
				this.bodyStatements = value;
			}
		}

		// Token: 0x17000218 RID: 536
		// (get) Token: 0x06000B6E RID: 2926 RVA: 0x0030611F File Offset: 0x0030431F
		// (set) Token: 0x06000B6F RID: 2927 RVA: 0x00306127 File Offset: 0x00304327
		public virtual TObjectName TriggerName
		{
			get
			{
				return this.triggerName;
			}
			set
			{
				this.triggerName = value;
			}
		}

		// Token: 0x06000B70 RID: 2928 RVA: 0x00306130 File Offset: 0x00304330
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TCreateTriggerSqlNode tcreateTriggerSqlNode = (TCreateTriggerSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.triggerName = tcreateTriggerSqlNode.TriggerName;
			base.DatabaseObjects.Add(this.triggerName);
			this.onTable = tcreateTriggerSqlNode.OnTable;
			this.tables.addTable(this.onTable);
			if (tcreateTriggerSqlNode.Stmt != null)
			{
				tcreateTriggerSqlNode.Stmt.doParse(this, ESqlClause.unknown);
				this.BodyStatements.add(tcreateTriggerSqlNode.Stmt.Stmt);
			}
			else if (tcreateTriggerSqlNode.Blcok != null)
			{
				tcreateTriggerSqlNode.Blcok.Stmts.doParse(this, ESqlClause.unknown);
				for (int i = 0; i < tcreateTriggerSqlNode.Blcok.Stmts.size(); i++)
				{
					this.BodyStatements.add(tcreateTriggerSqlNode.Blcok.Stmts.getStatementSqlNode(i).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x06000B71 RID: 2929 RVA: 0x00306219 File Offset: 0x00304419
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000B72 RID: 2930 RVA: 0x00306229 File Offset: 0x00304429
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.BodyStatements.acceptChildren(v);
			v.postVisit(this);
		}

		// Token: 0x040012B0 RID: 4784
		private TTable onTable;

		// Token: 0x040012B1 RID: 4785
		private TStatementList bodyStatements;

		// Token: 0x040012B2 RID: 4786
		private TObjectName triggerName;
	}
}
